from transaction import Transaction, UnverifiedTransaction

def test():
    key = 'b08820479c40797ba8452368595cdc6d7207580828d74ae1c9aa9f0e50fa71bd'
    region_id = "0x000000000004966900000000656820bc00000000"
    contract_address = "0xa61a6fb862c6b4d930790f65925709916b13abf7"
    
    # class Transaction(rlp.Serializable):
    # fields = [
    #     ('region_id', big_endian_int),
    #     ('nonce', big_endian_int),
    #     ('block_limit', big_endian_int),
    #     ('target', big_endian_int),
    #     ('data', binary),
    # ]

    tx = Transaction(
        region_id,
        0,
        5000,
        contract_address,
        '0xafce86359028222c6a53c5ccf375e7f23a827214f22608db89cb25b915e6e48a'
    )

    utx = UnverifiedTransaction(tx)

    utx.sign(key)

    print(utx)

    print(utx.rlp_encode())

test()